<?php

/**
 * Commentaire form base class.
 *
 * @method Commentaire getObject() Returns the current form's model object
 *
 * @package    appcemhti
 * @subpackage form
 * @author     Steve Cancès
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseCommentaireForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id_commentaire' => new sfWidgetFormInputHidden(),
      'id_lot'         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Lot'), 'add_empty' => true)),
      'id_traitement'  => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Traitement'), 'add_empty' => true)),
      'id_echantillon' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Echantillon'), 'add_empty' => true)),
      'id_user'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('User'), 'add_empty' => false)),
      'id_mesure'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Mesure'), 'add_empty' => true)),
      'contenu'        => new sfWidgetFormTextarea(),
      'created_at'     => new sfWidgetFormDateTime(),
      'updated_at'     => new sfWidgetFormDateTime(),
      'visible'        => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'id_commentaire' => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id_commentaire')), 'empty_value' => $this->getObject()->get('id_commentaire'), 'required' => false)),
      'id_lot'         => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Lot'), 'required' => false)),
      'id_traitement'  => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Traitement'), 'required' => false)),
      'id_echantillon' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Echantillon'), 'required' => false)),
      'id_user'        => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('User'))),
      'id_mesure'      => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Mesure'), 'required' => false)),
      'contenu'        => new sfValidatorString(array('required' => false)),
      'created_at'     => new sfValidatorDateTime(array('required' => false)),
      'updated_at'     => new sfValidatorDateTime(array('required' => false)),
      'visible'        => new sfValidatorInteger(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('commentaire[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Commentaire';
  }

}
